<template>
  <div>
    <el-button type="success" @click="success">Success</el-button>
    <el-button type="danger" @click="failed">Failed</el-button>
    
  <el-button type="primary" @click="cancelTokenGet">点击取消重复Get请求</el-button>
  <el-button type="primary" @click="cancelTokenPost">点击取消重复Post请求</el-button>
  </div>
</template>

<script>
import {request} from "network/request"

export default {
  name:'useMessage',
  methods:{
    success() {
      this.$cus_message("success")
    },
    failed() {
      this.$cus_message("failed")
    },
     cancelTokenGet(){
      request({
        url:'/vir_gitee2686ce3bg5350/demo/visualapi',
        headers:{
        },
        // noCancel:true
      }).then(res=>{
        console.log(res)
      }).catch((err)=>{
        console.log(err)
      })
    },
     cancelTokenPost(){
      request({
        url:'/vir_gitee2686ce3bg5350/demo/comment',
        method:'post',
        headers:{
          
      // 'Content-Type': 'application/json',
        },
        data:{
          id:123,
          content:'评论'
        }
      }).then(res=>{
        console.log(res)
      }).catch((err)=>{
        console.log(err)
      })
    }
  }
}
</script>

<style>

</style>